#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <errno.h>

typedef struct dev_ip_conf
{
	char id[12];
	char ip[16];
	char subnet[16];
	char gwip[16];
	char dnsip[16];
	char username[16];
	char code[16];
}sdev_ip_conf;

int main(int argc, char **argv)
{
	int ret = 0,num;
	sdev_ip_conf set_status;
	unsigned char buff[] = {0x52,0x30,0x32,0x30,0x30,0x34,0x49,0x50,0x43,0x3b,0x31,0x39,0x32,0x2e,0x31,0x36,0x38,0x2e,0x30,0x2e,0x31,0x37,0x38,0x3b,0x32,0x35,0x35,0x2e,0x32,0x35,0x35,0x2e,0x32,0x35,0x35,0x2e,0x30,0x3b,0x31,0x39,0x32,0x2e,0x31,0x36,0x38,0x2e,0x30,0x2e,0x31,0x3b,0x31,0x39,0x32,0x2e,0x31,0x36,0x38,0x2e,0x30,0x2e,0x31,0x3b,0x61,0x64,0x6d,0x69,0x6e,0x3b,0x30,0x32,0x35,0x36,0x36,0x36,0x00};

	printf("Buff string: %s\n",buff);

	num = sscanf((char*)buff,"%[^;];%[^;];%[^;];%[^;];%[^;];%[^;];%[^;]",
			set_status.id,set_status.ip,
			set_status.subnet,set_status.gwip,
			set_status.dnsip,set_status.username,
			set_status.code);

	printf("sscanf buff[%d]: id = %s,ip = %s, subnet = %s, gwip = %s, dnsip = %s, user = %s, code = %s\n",num,
			set_status.id,set_status.ip,
			set_status.subnet,set_status.gwip,
			set_status.dnsip,set_status.username,
			set_status.code);

	return ret;
}
